﻿<UserControl x:Class="Hisaab.Client.Modules.Core.Management.View.ImportView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Style="{DynamicResource BackStageControl}"
             xmlns:ribbon="clr-namespace:Fluent;assembly=Fluent"
             xmlns:h="clr-namespace:Hisaab.Client.Common.Helpers;assembly=Hisaab.Client.Common"
             xmlns:Common="clr-namespace:Hisaab.Client.Common;assembly=Hisaab.Client.Common"
             xmlns:Converters="clr-namespace:Hisaab.Client.Common.Converters;assembly=Hisaab.Client.Common">
    <UserControl.Resources>
        <Converters:BankToLogoConverter x:Key="bankLogoConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="500" />
        </Grid.ColumnDefinitions>
        <StackPanel>
            <StackPanel Orientation="Horizontal" >
                <Image Height="47" Source="pack://application:,,,/Hisaab.Client.Common;component/Resources/Images/32/Import.png" Stretch="None" VerticalAlignment="Center" Width="42" />
                <Label Content="Import External Data" Style="{DynamicResource BackstageLabelBig}" VerticalContentAlignment="Center" Margin="0" />
            </StackPanel>
            <Image Source="pack://application:,,,/Hisaab.Client.Common;component/Resources/Images/dottedline.png" Stretch="None" HorizontalAlignment="Left" VerticalAlignment="Center" />

            <Label Content="Select source of data you want to import" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{DynamicResource BackstageLabel}" />
            <ribbon:ComboBox Margin="0,0,0,20" SelectedValue="{Binding SelectedDataSource}" HorizontalAlignment="Left" 
                             ItemsSource="{Binding Source={h:Enumeration {x:Type Common:Banks}}}" SelectedValuePath="Value" >
                <ribbon:ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="42" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>
                            <Image Margin="4" Source="{Binding Value, Converter={StaticResource bankLogoConverter}}" HorizontalAlignment="Center" VerticalAlignment="Center" Stretch="None" Grid.Column="0" />
                            <TextBlock Text="{Binding Description}" VerticalAlignment="Center" Grid.Column="1" />
                        </Grid>                        
                    </DataTemplate>
                </ribbon:ComboBox.ItemTemplate>
            </ribbon:ComboBox>

            <Label Content="Select file to import" HorizontalAlignment="Left" VerticalAlignment="Center" Style="{DynamicResource BackstageLabel}" />
            <TextBox VerticalAlignment="Top" Height="24" HorizontalAlignment="Stretch" Text="{Binding FilePath, UpdateSourceTrigger=PropertyChanged}" />
            <ribbon:Button HorizontalAlignment="Right" VerticalAlignment="Stretch" Height="24" Style="{DynamicResource ButtonBackstageStyleSmall}" Command="{Binding BrowseCommand}" Width="120"
                           Icon="pack://application:,,,/Hisaab.Client.Common;component/Resources/Images/16/open.png">Browse</ribbon:Button>
            <ribbon:Button Grid.Row="9" Grid.Column="1" Style="{DynamicResource ButtonBackstageStyle}" Command="{Binding ImportBankDataCommand}"
                       LargeIcon="Pack://application:,,,/Hisaab.Client.Common;component/Resources/Images/32/Import.png" HorizontalAlignment="Left">Import Data</ribbon:Button>
        </StackPanel>
    </Grid>
</UserControl>